package com.hrt.base;

import java.sql.Timestamp;
import java.util.List;

import org.hibernate.SessionFactory;
import org.springframework.stereotype.Repository;

import com.hrt.bean.GiftInfor;


@Repository
public interface BaseDao<E> {

	/**
	 * @return
	 */
	public Long totalCount();

	/**
	 * 
	 * 
	 * @param entity
	 * @return 
	 */
	public Long saveEntity(E entity) ;

	/**
	 * 
	 * 
	 * @param entity
	 * @return 
	 */
	public void updateEntity(E entity) ;

	/**
	 *
	 * 
	 * @param id
	 */
	public void deleteEntity(Long id) ;

	/**
	 * 
	 * 
	 * @param id
	 * @return
	 */
	public E getById(Long id);

	/**
	 * 
	 * 
	 * @param ids
	 * @return
	 */
	public List<E> getByIds(Long[] ids);

	/**
	 * 
	 * 
	 * @return
	 */
	public List<E> findAll();

	/**
	 * 
	 * @param pageIndex
	 * @param pageSize
	 * @return
	 */
	public abstract List<E> queryByPage(int pageIndex, int pageSize);
	
	
	public abstract List<E> queryByPage(String sql,int pageIndex, int pageSize);

	public void setSessionFactoryOverride(SessionFactory sessionFactory);

	public void saveOrUpdateEntity(E entity);
	
	/**获取数据库的当前Date形式的时间*/
	public Timestamp getDate();
	
	public  List<E>  queryPageByCondition(List conditions,int pageIndex,int pageSize);
	
	public  List<E> queryByCondition(List conditions);
	
	public E loadById(Class<E> clzz, Long id);

	public List<E> loadList(Class<E> clzz);
}
